/*
 * Copyright (c) 2006 - 2022, webrx.cn All rights reserved.
 *
 */
package cn;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

/**
 * <p>Project: app2022 - Str7
 * <p>Powered by webrx On 2022-01-12 16:56:55
 *
* @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str7 {
    public static void main(String[] args) {
        String str = " ";
        //是不是空的，length() == 0
        System.out.println(str.isEmpty());//false
        //判断字符串是不是空的，如果有空格（不计）
        System.out.println(str.isBlank());//true
        System.out.println("*".repeat(6));


        System.out.println("   java    ".trim());
        System.out.println("   java    ".strip());
        System.out.println("   java    ".stripLeading());//去除左边连续空格
        System.out.println("   java    ".stripTrailing());//去除右边连续空格
        System.out.println("a\nbc\nddd".lines().count());
        //统计当前java文件源码有多少行代码 ctrl + shift + c 复制当前文件的路径
        String src = "C:\\app2022\\05mavenstring\\src\\main\\java\\cn\\Str7.java";
        try(var fis = new BufferedReader(new FileReader(src))) {
            System.out.println(fis.lines().count());
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
